package com.edu.exam.enums.grading;

/**
 * 修正状态枚举
 */
public enum CorrectionStatus {
    DRAFT("DRAFT", "草稿"),
    SUBMITTED("SUBMITTED", "已提交"),
    PENDING("PENDING", "待处理"),
    UNDER_REVIEW("UNDER_REVIEW", "审核中"),
    APPROVED("APPROVED", "已批准"),
    REJECTED("REJECTED", "已拒绝"),
    EXECUTING("EXECUTING", "执行中"),
    COMPLETED("COMPLETED", "已完成"),
    CANCELLED("CANCELLED", "已取消"),
    REVOKED("REVOKED", "已撤销");

    private final String code;
    private final String description;

    CorrectionStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static CorrectionStatus fromCode(String code) {
        for (CorrectionStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return DRAFT; // 默认返回草稿
    }
}